// @charset "utf-8";

define(function(require, exports, module) {
	var clientApi = require('../../public/clientapi');
	var publicMethod = require('../../public/public');

	var hgtzjModel = {
		latestTradeDay: '',
		getIsTrading: function(date, hsgtzjcall) {
			$.support.cors = true;
			var url = publicMethod.urlList.hsgtUrl + date + '/';
			publicMethod.ajaxJson({
				url: url,
				callback: function(result) {
					hsgtzjcall(result);
				}
			});
		},
		hsgtzjData: {},
		requestData: function(beginDate, endDate, callback) {
			var self = this;
			// var startDate = param.begin,
			// 	endDate = '';
			// if (param.period == 'min') {
			// 	endDate = param.begin;
			// } else {
			// 	endDate = param.end;
			// }
			endDate = endDate || beginDate;
			var bool = clientApi.thsQuote.requestZxData({
				url: 'zx/get_homepage_data.lua?op=hsgtdata&begin_date=' + beginDate + '&end_date=' + endDate + '/',
				onready: function(result) {
					result = JSON.parse(result);
					self.hsgtzjData = result;
					callback(result);
				}
			});
			if (!bool) {
				callback('[]');
			}
		}
	};

	module.exports = hgtzjModel;
});